package com.stage.singleton;

/**
 * Created by Stage on 2017/3/17.
 */
//双重锁
public class DoubleLockSingleton {

    private static volatile DoubleLockSingleton singleton = null;

    private DoubleLockSingleton() {
        // ToDo  do somthing here
    }

    public static DoubleLockSingleton getInstance() {
        if (singleton == null) {
            synchronized (Singleton.class) {
                if (singleton == null) {
                    singleton = new DoubleLockSingleton();
                }
            }
        }
        return singleton;
    }
}
